//---------------------------------------------------------------------------

#ifndef MotorComponentH
#define MotorComponentH

#include <vcl.h>

//---------------------------------------------------------------------------
typedef enum {VERTICAL = 0, HORIZONTAL = !VERTICAL} ComponentDirStatus;

class TMotorComponent
{
private:
	AnsiString Name;
	int Min;
	int Max;
	bool Editable;	// For edit the coordinate and the direction of MGroup
	bool Enabled;		// For MotorComponent is enabled or not.
	ComponentDirStatus MDir;

public:
	TGroupBox *MGroup;
	TShape *MShape;
	TButton *MButtonMain;
	TEdit *MEdit;
	TScrollBar *MBar;
	TButton *MButtonP;
	TButton *MButtonN;
	TCheckBox *MCheck;

	TMotorComponent(TWinControl *Sender, int GB_num, int Min, int Max);
	TMotorComponent(TWinControl *Sender, int GB_num, ComponentDirStatus Dir, int Top, int Left, int Min, int Max);
	~TMotorComponent();

	void SetProperties(int GB_num, ComponentDirStatus Dir, int Top, int Left, int Min, int Max);
	void SetEvents();

	void MoveMGroup(int Top, int Left);
	ComponentDirStatus GetDirection();
	void SetDirection(ComponentDirStatus Dir);
	void SetPositionLimit(int min, int max);
	void SetEnabled(bool enabled);
	bool GetEnabled();

	// Event for editing the coordinate and the direction of MGroup
	void __fastcall MGroupEndDrag(TObject *Sender, TObject *Target, int X, int Y);
	void __fastcall MGroupMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
					int X, int Y);
	void __fastcall MGroupDragOver(TObject *Sender, TObject *Source, int X, int Y,
					TDragState State, bool &Accept);
	void __fastcall MButtonMainMouseDown(TObject *Sender, TMouseButton Button, TShiftState Shift,
					int X, int Y);
	void __fastcall MButtonMainKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
	void __fastcall MButtonMainKeyPress(TObject *Sender, wchar_t &Key);
};
//---------------------------------------------------------------------------
#endif

